<?php
//公共函数

//成功返回
function success($msg = '',$data=null)
{
    return json([
        'code'=>'1',
        'msg'=>$msg,
        'data'=>$data,
    ]);
}
//失败返回
function error($msg = '',$data=null)
{
    return json([
        'code'=>'0',
        'msg'=>$msg,
        'data'=>$data,
    ]);
}
//密码加密
function createRandStr($length = 8)
{
    $str = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $rendstr = '';
    for ($i = 0;$i < $length;$i++)
    {
        $rendstr .= $str[mt_rand(0,35)];
    }
    return $rendstr;
}